from PySide.QtCore import QUrl
from PySide.QtGui import QDialog
from PySide.phonon import Phonon

class KhanTube(QDialog):
    def __init__(self):
        QDialog.__init__(self)
        self.setWindowTitle('KhanTube')
        self.resize(600, 400)

        self.media = Phonon.MediaObject(self)

        videoWidget = Phonon.VideoWidget(self)
        Phonon.createPath(self.media, videoWidget)

        audioOutput = Phonon.AudioOutput(Phonon.VideoCategory, self)
        Phonon.createPath(self.media, audioOutput)

        url = QUrl('http://upload.wikimedia.org/wikipedia/commons/2/2b/Cub_polar_bear_is_nursing_2.OGG')
        self.media.setCurrentSource(Phonon.MediaSource(url))
        self.media.play()


